class Solution:
    # 用的是二分法的思想
    def duplicate(self, numbers):
        m = len(numbers)
        start = 1
        end = m
        while start<=end:
            middle = int((start+end)/2)
            count=0
            for i in range(m):
                if numbers[i]<=middle and numbers[i]>=start:
                    count+=1
            if count>(middle-start+1):
                start,end = start,middle
            else:
                start, end = middle+1, end
            if start==end:
                c=0
                for i in numbers:
                    if i == start:
                        c+=1
                if c>1:
                    return start
                else:
                    break
        return False

Lst3 = [1,2,2]
s=Solution()
m = s.duplicate(Lst3)
print(m)
